#include "../include/PageLib.hpp"
#include "../include/WebPageOffline.hpp"
#include "../include/Configuration.hpp"
#include "../include/WebPageLib.hpp"
#include "../include/RssReader.hpp"
#include <iostream>

using namespace wd;

Configuration* Configuration::_pInstance = nullptr;
void test1(){
    DirScanner dirScanner("/home/hcg/CPP2/SE_v2/conf/yuliao/人民网语料");
    RssReader rssReader;
    vector<string> filesPath = dirScanner.get_absolute_files();
    for(auto& elem : filesPath){
        rssReader.parseRss(elem);
    }
    PageLib pageLib(dirScanner,rssReader);
    pageLib.store("../data/ripepage.dat","../data/offset.dat");
    
}

void test2()
{
    WebPageLib webPageLib("../conf/yuliao/stop_words_zh.txt","../data/ripepage.dat","../data/offset.dat");
    webPageLib.storeOnDisk("../data/newripepage.dat","../data/newoffset.dat","../data/invertIndexLib.dat");
}

int main()
{
    cout<<"build pagelib & offsetlib"<<endl;
    test1();
    cout<<"build newpagelib & newoffsetlib & invertindexlib"<<endl;
    test2();
    return 0;
}

